Skip to content

fix: add explicit length check for Symbol (Closes #1564)#1663

Merged
Baskarayelu merged 6 commits into
QuickLendX:mainfrom
SHEROSE0:fix/symbol-length-limit-1564
Jun 27, 2026
Merged

fix: add explicit length check for Symbol (Closes #1564)#1663
Baskarayelu merged 6 commits into
QuickLendX:mainfrom
SHEROSE0:fix/symbol-length-limit-1564

Conversation

@SHEROSE0

Copy link
Copy Markdown
Contributor

#Closes #1564

Summary

Added an explicit length check to the set_symbol function to reject symbols exceeding 9 characters. This is a defense-in-depth measure to prevent potential issues before the Symbol::new() instantiation.

Threat Model

If this check is missing, an attacker could potentially supply an oversized string, which might lead to resource exhaustion during contract execution. Validating this at the contract entry point ensures we reject invalid inputs early, saving compute costs and preventing unexpected behavior.

Performance Impact

The overhead of this check is negligible. Verified confirming it remains well within the gas limits for this transaction path.

Verification

  • Negative test case added to src/test.rs to verify rejection of symbols > 9 characters.
  • Verified local build compatibility.
  • Verified code safety.
    #closes

Threat Model: Prevents potential resource exhaustion by rejecting symbols > 9 chars before instantiation. Cost: Verified via env.cost_estimate().
@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@SHEROSE0 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Baskarayelu

Copy link
Copy Markdown
Contributor

add explicit length check for Symbol (Closes #1564) — clean work, in it goes 🚀

@Baskarayelu Baskarayelu merged commit a353790 into QuickLendX:main Jun 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add explicit length check on user-supplied Symbol

2 participants